package com.boarsoft.flow.core.bean;

/**
 * @author Mac_J
 *
 * @param <T>
 *            Transaction
 */
public interface TransactionHandler<T> {
	/**
	 * 
	 * @param data
	 * @return Transaction Object
	 * @throws Exception
	 */
	T begin(Object data) throws Exception;

	/**
	 * 如果事务还没有提交则提交当前事务
	 * 
	 * @param tx
	 *            Transaction Object
	 * @throws Exception
	 */
	void commit(T tx) throws Exception;

	/**
	 * 
	 * @param tx
	 *            Transaction Object
	 * @throws Exception
	 */
	void rollback(T tx) throws Exception;
}
